const mysql = require('mysql2/promise');

async function checkAreasTable() {
  const connection = await mysql.createConnection({
    host: '43.143.253.188',
    user: 'nextjs',
    password: 'yEAiRE2jcxTyRBy5',
    database: 'nextjs'
  });

  try {
    console.log('🔍 检查areas表结构...');
    
    // 获取表结构
    const [columns] = await connection.execute('DESCRIBE areas');
    console.log('\n📋 areas表结构:');
    columns.forEach(col => {
      console.log(`  ${col.Field}: ${col.Type} ${col.Null === 'NO' ? 'NOT NULL' : 'NULL'} ${col.Key ? col.Key : ''} ${col.Default ? `DEFAULT ${col.Default}` : ''}`);
    });
    
    // 获取表数据
    const [rows] = await connection.execute('SELECT * FROM areas LIMIT 5');
    console.log('\n📊 areas表数据 (前5条):');
    rows.forEach((row, index) => {
      console.log(`  ${index + 1}. ${JSON.stringify(row)}`);
    });
    
  } catch (error) {
    console.error('❌ 检查areas表失败:', error.message);
  } finally {
    await connection.end();
  }
}

checkAreasTable();
